Optimal. Leaf size=119 \[ \frac {i (c+d x)^2}{a f}+\frac {(c+d x)^3}{3 a d}-\frac {4 d (c+d x) \log \left (1+e^{i (e+f x)}\right )}{a f^2}+\frac {4 i d^2 \text {PolyLog}\left (2,-e^{i (e+f x)}\right )}{a f^3}-\frac {(c+d x)^2 \tan \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.350, Rules used = {4276, 3399,
4269, 3800, 2221, 2317, 2438} \begin {gather*} -\frac {4 d (c+d x) \log \left (1+e^{i (e+f x)}\right )}{a f^2}-\frac {(c+d x)^2 \tan \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {i (c+d x)^2}{a f}+\frac {(c+d x)^3}{3 a d}+\frac {4 i d^2 \text {Li}_2\left (-e^{i (e+f x)}\right )}{a f^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2221
Rule 2317
Rule 2438
Rule 3399
Rule 3800
Rule 4269
Rule 4276
Rubi steps
\begin {align*} \int \frac {(c+d x)^2}{a+a \sec (e+f x)} \, dx &=\int \left (\frac {(c+d x)^2}{a}-\frac {(c+d x)^2}{a+a \cos (e+f x)}\right ) \, dx\\ &=\frac {(c+d x)^3}{3 a d}-\int \frac {(c+d x)^2}{a+a \cos (e+f x)} \, dx\\ &=\frac {(c+d x)^3}{3 a d}-\frac {\int (c+d x)^2 \csc ^2\left (\frac {e+\pi }{2}+\frac {f x}{2}\right ) \, dx}{2 a}\\ &=\frac {(c+d x)^3}{3 a d}-\frac {(c+d x)^2 \tan \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {(2 d) \int (c+d x) \tan \left (\frac {e}{2}+\frac {f x}{2}\right ) \, dx}{a f}\\ &=\frac {i (c+d x)^2}{a f}+\frac {(c+d x)^3}{3 a d}-\frac {(c+d x)^2 \tan \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}-\frac {(4 i d) \int \frac {e^{2 i \left (\frac {e}{2}+\frac {f x}{2}\right )} (c+d x)}{1+e^{2 i \left (\frac {e}{2}+\frac {f x}{2}\right )}} \, dx}{a f}\\ &=\frac {i (c+d x)^2}{a f}+\frac {(c+d x)^3}{3 a d}-\frac {4 d (c+d x) \log \left (1+e^{i (e+f x)}\right )}{a f^2}-\frac {(c+d x)^2 \tan \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {\left (4 d^2\right ) \int \log \left (1+e^{2 i \left (\frac {e}{2}+\frac {f x}{2}\right )}\right ) \, dx}{a f^2}\\ &=\frac {i (c+d x)^2}{a f}+\frac {(c+d x)^3}{3 a d}-\frac {4 d (c+d x) \log \left (1+e^{i (e+f x)}\right )}{a f^2}-\frac {(c+d x)^2 \tan \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}-\frac {\left (4 i d^2\right ) \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i \left (\frac {e}{2}+\frac {f x}{2}\right )}\right )}{a f^3}\\ &=\frac {i (c+d x)^2}{a f}+\frac {(c+d x)^3}{3 a d}-\frac {4 d (c+d x) \log \left (1+e^{i (e+f x)}\right )}{a f^2}+\frac {4 i d^2 \text {Li}_2\left (-e^{i (e+f x)}\right )}{a f^3}-\frac {(c+d x)^2 \tan \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(528\) vs. \(2(119)=238\).
time = 6.37, size = 528, normalized size = 4.44 \begin {gather*} \frac {2 x \left (3 c^2+3 c d x+d^2 x^2\right ) \cos ^2\left (\frac {e}{2}+\frac {f x}{2}\right ) \sec (e+f x)}{3 (a+a \sec (e+f x))}-\frac {8 c d \cos ^2\left (\frac {e}{2}+\frac {f x}{2}\right ) \sec \left (\frac {e}{2}\right ) \sec (e+f x) \left (\cos \left (\frac {e}{2}\right ) \log \left (\cos \left (\frac {e}{2}\right ) \cos \left (\frac {f x}{2}\right )-\sin \left (\frac {e}{2}\right ) \sin \left (\frac {f x}{2}\right )\right )+\frac {1}{2} f x \sin \left (\frac {e}{2}\right )\right )}{f^2 (a+a \sec (e+f x)) \left (\cos ^2\left (\frac {e}{2}\right )+\sin ^2\left (\frac {e}{2}\right )\right )}-\frac {8 d^2 \cos ^2\left (\frac {e}{2}+\frac {f x}{2}\right ) \csc \left (\frac {e}{2}\right ) \left (\frac {1}{4} e^{-i \text {ArcTan}\left (\cot \left (\frac {e}{2}\right )\right )} f^2 x^2-\frac {\cot \left (\frac {e}{2}\right ) \left (\frac {1}{2} i f x \left (-\pi -2 \text {ArcTan}\left (\cot \left (\frac {e}{2}\right )\right )\right )-\pi \log \left (1+e^{-i f x}\right )-2 \left (\frac {f x}{2}-\text {ArcTan}\left (\cot \left (\frac {e}{2}\right )\right )\right ) \log \left (1-e^{2 i \left (\frac {f x}{2}-\text {ArcTan}\left (\cot \left (\frac {e}{2}\right )\right )\right )}\right )+\pi \log \left (\cos \left (\frac {f x}{2}\right )\right )-2 \text {ArcTan}\left (\cot \left (\frac {e}{2}\right )\right ) \log \left (\sin \left (\frac {f x}{2}-\text {ArcTan}\left (\cot \left (\frac {e}{2}\right )\right )\right )\right )+i \text {PolyLog}\left (2,e^{2 i \left (\frac {f x}{2}-\text {ArcTan}\left (\cot \left (\frac {e}{2}\right )\right )\right )}\right )\right )}{\sqrt {1+\cot ^2\left (\frac {e}{2}\right )}}\right ) \sec \left (\frac {e}{2}\right ) \sec (e+f x)}{f^3 (a+a \sec (e+f x)) \sqrt {\csc ^2\left (\frac {e}{2}\right ) \left (\cos ^2\left (\frac {e}{2}\right )+\sin ^2\left (\frac {e}{2}\right )\right )}}-\frac {2 \cos \left (\frac {e}{2}+\frac {f x}{2}\right ) \sec \left (\frac {e}{2}\right ) \sec (e+f x) \left (c^2 \sin \left (\frac {f x}{2}\right )+2 c d x \sin \left (\frac {f x}{2}\right )+d^2 x^2 \sin \left (\frac {f x}{2}\right )\right )}{f (a+a \sec (e+f x))} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 235 vs. \(2 (107 ) = 214\).
time = 0.66, size = 236, normalized size = 1.98
method | result | size |
risch | \(\frac {d^{2} x^{3}}{3 a}+\frac {d c \,x^{2}}{a}+\frac {c^{2} x}{a}+\frac {c^{3}}{3 a d}-\frac {2 i \left (d^{2} x^{2}+2 c d x +c^{2}\right )}{f a \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}+\frac {4 d c \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{a \,f^{2}}-\frac {4 d c \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{a \,f^{2}}+\frac {2 i d^{2} x^{2}}{a f}+\frac {4 i d^{2} e x}{a \,f^{2}}+\frac {2 i d^{2} e^{2}}{a \,f^{3}}-\frac {4 d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) x}{a \,f^{2}}+\frac {4 i d^{2} \polylog \left (2, -{\mathrm e}^{i \left (f x +e \right )}\right )}{a \,f^{3}}-\frac {4 d^{2} e \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{a \,f^{3}}\) | \(236\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 393 vs. \(2 (107) = 214\).
time = 0.67, size = 393, normalized size = 3.30 \begin {gather*} -\frac {i \, d^{2} f^{3} x^{3} + 3 i \, c d f^{3} x^{2} + 3 i \, c^{2} f^{3} x + 6 \, c^{2} f^{2} + 12 \, {\left (d^{2} f x + c d f + {\left (d^{2} f x + c d f\right )} \cos \left (f x + e\right ) - {\left (-i \, d^{2} f x - i \, c d f\right )} \sin \left (f x + e\right )\right )} \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right ) + 1\right ) + {\left (i \, d^{2} f^{3} x^{3} - 3 \, {\left (-i \, c d f^{3} + 2 \, d^{2} f^{2}\right )} x^{2} - 3 \, {\left (-i \, c^{2} f^{3} + 4 \, c d f^{2}\right )} x\right )} \cos \left (f x + e\right ) - 12 \, {\left (d^{2} \cos \left (f x + e\right ) + i \, d^{2} \sin \left (f x + e\right ) + d^{2}\right )} {\rm Li}_2\left (-e^{\left (i \, f x + i \, e\right )}\right ) - 6 \, {\left (i \, d^{2} f x + i \, c d f + {\left (i \, d^{2} f x + i \, c d f\right )} \cos \left (f x + e\right ) - {\left (d^{2} f x + c d f\right )} \sin \left (f x + e\right )\right )} \log \left (\cos \left (f x + e\right )^{2} + \sin \left (f x + e\right )^{2} + 2 \, \cos \left (f x + e\right ) + 1\right ) - {\left (d^{2} f^{3} x^{3} + 3 \, {\left (c d f^{3} + 2 i \, d^{2} f^{2}\right )} x^{2} + 3 \, {\left (c^{2} f^{3} + 4 i \, c d f^{2}\right )} x\right )} \sin \left (f x + e\right )}{-3 i \, a f^{3} \cos \left (f x + e\right ) + 3 \, a f^{3} \sin \left (f x + e\right ) - 3 i \, a f^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 307 vs. \(2 (107) = 214\).
time = 3.30, size = 307, normalized size = 2.58 \begin {gather*} \frac {d^{2} f^{3} x^{3} + 3 \, c d f^{3} x^{2} + 3 \, c^{2} f^{3} x + {\left (d^{2} f^{3} x^{3} + 3 \, c d f^{3} x^{2} + 3 \, c^{2} f^{3} x\right )} \cos \left (f x + e\right ) - 6 \, {\left (i \, d^{2} \cos \left (f x + e\right ) + i \, d^{2}\right )} {\rm Li}_2\left (-\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right )\right ) - 6 \, {\left (-i \, d^{2} \cos \left (f x + e\right ) - i \, d^{2}\right )} {\rm Li}_2\left (-\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right )\right ) - 6 \, {\left (d^{2} f x + c d f + {\left (d^{2} f x + c d f\right )} \cos \left (f x + e\right )\right )} \log \left (\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right ) + 1\right ) - 6 \, {\left (d^{2} f x + c d f + {\left (d^{2} f x + c d f\right )} \cos \left (f x + e\right )\right )} \log \left (\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right ) + 1\right ) - 3 \, {\left (d^{2} f^{2} x^{2} + 2 \, c d f^{2} x + c^{2} f^{2}\right )} \sin \left (f x + e\right )}{3 \, {\left (a f^{3} \cos \left (f x + e\right ) + a f^{3}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {c^{2}}{\sec {\left (e + f x \right )} + 1}\, dx + \int \frac {d^{2} x^{2}}{\sec {\left (e + f x \right )} + 1}\, dx + \int \frac {2 c d x}{\sec {\left (e + f x \right )} + 1}\, dx}{a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\left (c+d\,x\right )}^2}{a+\frac {a}{\cos \left (e+f\,x\right )}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________